package client;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import util.Log;

public class NettyEchoClientHandler extends ChannelInboundHandlerAdapter {

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {

        ByteBuf byteBuf = (ByteBuf) msg;
        int len = byteBuf.readableBytes();
        byte[] buff = new byte[len];
        byteBuf.getBytes(0, buff);
        Log.i("收到服务器信息：" + new String(buff));
        byteBuf.release();
       // super.channelRead(ctx, msg);
    }
}
